package com.coding.service.impl;

import com.coding.base.pojo.BaseModel;
import com.coding.dao.LocationDao;
import com.coding.pojo.Location;
import com.coding.service.LocationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @auther wangchenghao
 * @date 2020/8/21
 **/
@Service
public class LocationImpl implements LocationService {
    @Autowired
    LocationDao locationDao;
    @Override
    public void selectById(int id, BaseModel baseModel) throws Exception {
        Location location=locationDao.selectByPrimaryKey(id);
        if (location!=null){
            baseModel.setSucceed("成功获得该地点坐标",location);
        }else {
            baseModel.setFailure("获得地点坐标失败");
        }

    }

    @Override
    public void selectByName(String name, BaseModel baseModel) throws Exception {
        Location location=locationDao.selectByName(name);
        if (location!=null){
            baseModel.setSucceed("成功获得该地点坐标",location);
        }else {
            baseModel.setFailure("获得地点坐标失败");
        }
    }
}
